package org.oschina.api;

import org.apache.commons.lang.ObjectUtils;
import org.oschina.Constants;
import org.oschina.helper.ThreadVariableHelper;
import org.springframework.beans.factory.annotation.Autowired;

public class BaseService {

	@Autowired
	private ThreadVariableHelper threadVariableHelper;
	
	/**
	 * 获得令牌
	 * @return
	 */
	protected String getToken()
	{
		return ObjectUtils.toString(threadVariableHelper.get(Constants.THREAD_VARIABLE_TOKEN));
	}
	
	/**
	 * 获得IP
	 * @return
	 */
	protected String getIp()
	{
		return ObjectUtils.toString(threadVariableHelper.get(Constants.THREAD_VARIABLE_IP));
	}
	
}